#ifndef PITCHTHREAD_H
#define PITCHTHREAD_H

#include <QObject>
#include <QWidget>
#include "qthread.h"
#include "fmod.h"
#include "fmod.hpp"
#include "fmod_errors.h"

#include "qlistwidget.h"
#include "qlabel.h"

#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <math.h>
#include <sstream>
#include <string>

#include "../AudioModel/AudioUtils.h"

#define OUTPUTRATE          44100
#define SPECTRUMSIZE        8192
#define SPECTRUMRANGE       ((float)OUTPUTRATE / 2.0f)      /* 0 to nyquist */

#define BINSIZE      (SPECTRUMRANGE / (float)SPECTRUMSIZE)
using namespace std;

class PitchThread : public QThread
{
	Q_OBJECT

public:
	PitchThread(QLabel *noteWidget,QListWidget *recordDriverWidget, QListWidget *playBackDriverWidget,FMOD::System	* system,
					FMOD::Sound				*sound,
					FMOD::Channel			*channel,
					FMOD_CREATESOUNDEXINFO	exinfo,
					int						key,
					int driver,
					int recorddriver,
					int numdrivers,
					int count,
					int bin,
					unsigned int           version
				);
	~PitchThread();
	void run();

private:
	QListWidget *recordDriverWidget;
	QListWidget *playBackDriverWidget;
	QLabel *noteLabel;
	FMOD::System			*system;
	FMOD::Sound				*sound;
	FMOD::Channel			*channel;
	FMOD_RESULT				result;
	FMOD_CREATESOUNDEXINFO	exinfo;
	int						key;
	int driver;
	int recorddriver;
	int numdrivers;
	int count;
	int bin;
	unsigned int           version;
};

#endif // PITCHTHREAD_H
